package com.xiangyang.controller;

import com.xiangyang.entity.Employee;
import com.xiangyang.entity.dto.Result;
import com.xiangyang.entity.vo.EmployeeLike;
import com.xiangyang.service.impl.EmployeeServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/employee")
@CrossOrigin
public class EmployeeController {
    @Autowired
    private EmployeeServiceImpl doctorService;
    @PostMapping("/addstaff")   //@RequestBody 将前端传过来的json数据封装到实体类中
    public Result addDoctor(@RequestBody Employee employee){
        System.out.println(employee);
        return doctorService.addDoctor(employee);
    }
    @PostMapping("/deletestaff")
    public Result deleteDoctor( Long employeeId){

        return doctorService.deleteDoctor(employeeId);
    }
    @PostMapping("/updatestaff")
    public Result updateDoctor(@RequestBody Employee employee){

        return doctorService.updateDoctor(employee);
    }
    @PostMapping("/querystaff")
    public Result getDoctorList(){

        return doctorService.getDoctorList();
    }
    @PostMapping("/querystafflist")
    public Result getDoctorLists(Employee doctor){

        return doctorService.getDoctorLists(doctor);
    }
    @PostMapping("/querystaffbyid")
    public Result getDoctor(@RequestBody Employee doctor){

        return (Result) doctorService.getemployeeList(doctor);
    }
    @PostMapping("/querystaffbylike")
    public Result selectEmployee(@RequestBody EmployeeLike employee){

        return doctorService.selectEmployee(employee);
    }


}
